SWEP.Spawnable			= true
SWEP.AdminSpawnable		= true

SWEP.ViewModel			= "models/weapons/v_pistol.mdl"
SWEP.WorldModel			= "models/weapons/w_pistol.mdl"

SWEP.Weight				= 5
SWEP.AutoSwitchTo		= false
SWEP.AutoSwitchFrom		= false

SWEP.Primary.Recoil			= 1
SWEP.Primary.Damage			= 0
SWEP.Primary.NumShots		= 1
SWEP.Primary.Cone			= 0.02
SWEP.Primary.ClipSize		= -1
SWEP.Primary.Delay			= 240
SWEP.Primary.DefaultClip	= -1
SWEP.Primary.Automatic		= true
SWEP.Primary.Ammo			= "none"

SWEP.Secondary.ClipSize		= -1
SWEP.Secondary.DefaultClip	= -1
SWEP.Secondary.Automatic	= false
SWEP.Secondary.Delay 		= 1.0
SWEP.Secondary.Ammo			= "none"


local ShootSound = Sound( "weapons/ar2/ar2_altfire.wav" )
local A_SHOOT = false

if ( SERVER ) then

	AddCSLuaFile( "shared.lua" )
	
	SWEP.HoldType			= "pistol"
	
end

if ( CLIENT ) then

	SWEP.PrintName			= "Lone Shooter"			
	SWEP.Author				= "Faraday'"
	SWEP.Slot				= 2
	SWEP.SlotPos			= 3
	SWEP.Contact			= ""
	SWEP.Purpose			= "WBgun"
	SWEP.Instructions		= "LetfClick: Shoot a single wave of air balls (60 balls)"
	
end

function SWEP:LaunchBall( )
	if (!SERVER) then return end
	local RandAngles = Angle(math.random(0,360),math.random(0,360),math.random(0,360))
	local ply = self.Owner
	for i=0,60 do
	
	local bola = ents.Create("air_ball")
	bola:SetPos(ply:GetShootPos())
	bola:SetAngles( RandAngles )
	bola:Spawn()
	bola:Fire("Kill", "", 20)
	bola.iOwner = ply
	bola.iOwnerTeam = ply:Team()
			
	local bPhys = bola:GetPhysicsObject()
	local Force = ply:GetAimVector() * 100000
	bPhys:ApplyForceCenter(Force)
	
	end
	for k,v in pairs(ents.FindByClass("player")) do
	v:PrintMessage( HUD_PRINTCENTER, "LONE SHOOT RAMPAGE!")
    end
	self.Weapon:SetNextPrimaryFire(CurTime() + self.Primary.Delay)
end

function SWEP:PrimaryAttack( )
	self:LaunchBall()
	self.Weapon:EmitSound( ShootSound, 75, 110 )
	self.BaseClass.ShootEffects( self )
end
